<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>工作经历</title>
  <script type="text/javascript" src="<%=request.getContextPath() %>/common/jquery-1.8.2.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath() %>/common/My97DatePicker/WdatePicker.js"></script>
<jsp:include page="/common/easyui.jsp"></jsp:include>
<script type="text/javascript">
	function formateDate(value, row, index) {
		var date = new Date(value);
		return date.getFullYear() + "/" + (date.getMonth() + 1) + "/"
				+ date.getDay();
	}
	
</script>
</head>
<body>
	<table class="easyui-datagrid" style="width:800px;height:400px" id="edit"
		data-options="url:'<%=request.getContextPath()%>/user/lookThroughs.do',fitColumns:true,singleSelect:true,pagination:true,pageSize:7,pageList:[5,6,7],rownumbers:true,sortOrder:'desc',sortName:'startdate',toolbar:[{
				text:'增加',
				iconCls:'icon-add',
				handler:function(){
					$('#dialogBox').dialog({
						 closed: false
					})
				}
			}]">
		<thead>
			<tr>
				<th
					data-options="field:'companyname',width:100,sortable:true,order:'asc'">公司名称</th>
				<th
					data-options="field:'startdate',width:100,formatter:formateDate,sortable:true,order:'asc'">入职时间</th>
				<th
					data-options="field:'enddate',width:100,formatter:formateDate,sortable:true,order:'asc'">离职时间</th>
			</tr>
		</thead>
	</table>

	<div id="dialogBox" class="easyui-dialog" title="My Dialog"
		style="width:500px;height:450px;"
		data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true,buttons:[{
				text:'保存',
				handler:function(){
					$.ajax({
						type:'post',
						url:'<%=request.getContextPath() %>/user/saveThroughs.do',  <!-- 保存工作经历-->
						data:$('#throughForm').serialize(),
						success:function(msg){
							$.messager.alert(' ','保存成功');   
							$('#dialogBox').dialog({
								closed:true
							});
							$('#edit').datagrid('reload');
						}
					})
				 }
			},{
				text:'关闭',
				handler:function(){ $('#dialogBox').dialog({
					closed:true
				})}
			}]">
		<center>

			<form id="throughForm" method="post">
				<input type="hidden" name="id">
				<table cellpadding="15" cellspacing="0">
					<tr>
						<td>公司名称:</td>
						<td><input type="text" class="easyui-textbox" 
							name="companyname"  />
						</td>
					</tr>
					
					<tr>
						<td>入职时间:</td>
						<td>
							<input id="starttime" name="startdate" data-options="required:true" type="text"  onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'endtime\')}',dateFmt:'yyyy-MM-dd'})">
							
						</td>
					</tr>
					
					<tr>
						<td>离职时间:</td>
						<td>
							<input id="endtime" name="enddate" type="text" data-options="required:true"  onfocus="WdatePicker({minDate:'#F{$dp.$D(\'starttime\')}',maxDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd'})">
						</td>
					</tr>
				</table>
			</form>
		</center>
	</div>
</body>
</html>